package club.dmyang.shardingspheredemo.controller;

import club.dmyang.shardingspheredemo.entity.User;
import club.dmyang.shardingspheredemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/main")
public class MainController {

    @Autowired
    private UserService userService;

    @GetMapping("/t1")
    public String t1(Long id){

        User user = new User();
        user.setId(id);
        user.setAge(23);
        user.setPassword("abc");
        user.setUsername("zhangsan");
        return ""+userService.addOneUser(user);
    }
}
